package main

import (
	"fmt"
	"go-likaladi-shop/common/base_global"
	"go-likaladi-shop/common/base_util"
	"lw-shop/user_service/global/util"
	"lw-shop/user_service/model"
)

func main() {
	base_util.CreateTable(model.User{})
	//util.CreateTable(model.Order{})

	rawPwd := "likaladi"
	dbPwd := util.EncodePassword(rawPwd)
	fmt.Println(util.CheckPassword(rawPwd, dbPwd))

	for i := 0; i < 10; i++ {
		user := model.User{
			NickName: fmt.Sprintf("uname%d", i),
			Mobile:   fmt.Sprintf("1878222222%d", i),
			Password: dbPwd,
		}
		base_global.DB.Save(&user)
	}
	//
	//for i := 0; i < 10; i++ {
	//	order := model.LwOrder{
	//		OrderNo:     fmt.Sprintf("orderNo%d", i),
	//		UnitPrice:   float64(i),
	//		TotalNums:   i,
	//		TotalAmount: float64(i) * float64(i),
	//	}
	//	util.DB.Save(&order)
	//}
}
